//
//  EBUtility.h
//  test_productInfo
//
//  Created by zyh on 15/4/15.
//  Copyright (c) 2015年 zyh. All rights reserved.
//#import "LPLabel.h"
//#import "SectionBtn.h"

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
#define isKindOfNSDictionary(obj) (obj && ![obj isEqual:[NSNull null]] && [obj isKindOfClass:[NSDictionary class]])
#define isKindOfNSArray(obj)      (obj && ![obj isEqual:[NSNull null]] && [obj isKindOfClass:[NSArray class]])
#define isKindOfNSString(obj)      (obj && ![obj isEqual:[NSNull null]] && [obj isKindOfClass:[NSString class]])

// 获取RGB颜色
#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define RGB(r,g,b) RGBA(r,g,b,1.0f)

#define RGBA_COLOR(R, G, B, A) [UIColor colorWithRed:((R) / 255.0f) green:((G) / 255.0f) blue:((B) / 255.0f) alpha:A]
#define BTNTITLE_CORLOR RGBA(70, 196, 125, 1)
#define BTNBJ_CORLOR RGBA(70, 196, 125, 1)
#define LINE_CORLOR [EBUtility colorWithHexString:@"#15171A" alpha:1]

#define LINEBG_CORLOR [EBUtility colorWithHexString:@"#252627" alpha:1]
#define ZTHH_CORLOR [EBUtility colorWithHexString:@"#ffc303" alpha:1]//黄色
#define ZT_CORLOR [EBUtility colorWithHexString:@"#121518" alpha:1]//黑色--主色
#define ZTH_DI_CORLOR [EBUtility colorWithHexString:@"#f2f2f2" alpha:1]//浅灰
#define ZTS_DI_CORLOR [EBUtility colorWithHexString:@"#bfbfbf" alpha:1]//深灰
#define ZTX_DI_CORLOR [EBUtility colorWithHexString:@"#D3D3D3" alpha:1]//--灰

#define ZTH_Z_CORLOR [EBUtility colorWithHexString:@"#252008" alpha:1]//黑
#define ZTZT6_CORLOR [EBUtility colorWithHexString:@"#666666" alpha:1]//黑
#define ZTZT3_CORLOR [EBUtility colorWithHexString:@"#333333" alpha:1]//黑
#define ZTZT9_CORLOR [EBUtility colorWithHexString:@"#999999" alpha:1]//黑
#define ZTZThong_CORLOR [EBUtility colorWithHexString:@"#E0372D" alpha:1]//红
#define  kMainColor   @"#191E23"



#define md5Key @"jh20151121"

@interface EBUtility : NSObject
//+(void)prompt:(NSString *)string;
@property(nonatomic,strong) UIImageView *customActivityIndicator;
@property(nonatomic ,copy) NSString *userId;

+ (CGSize)sizeWithString:(NSString *)string font:(UIFont *)font ;//label自适应

+ (UIColor *)UIColorFromHexColor:(NSString *)hexColor;//16位颜色

+ (void)callWithString:(NSString *)phoneString;
+ (void)callWithURL:(NSURL *)url;
+ (NSString *)md5HexDigest:(NSString*)input;
+ (NSMutableAttributedString *)priceAttrStrWithCutline:(NSString *)priceStr;
+ (NSMutableAttributedString *)changePartStringStyleWithString:(NSString *)string WithColor:(UIColor *)color WithSize:(int)size WithRange:(NSRange)range;
+ (NSString *)md51:(NSString *)str;
/**
 *  价格样式富文本
 */
+ (NSMutableAttributedString *)setPriceAttrStr:(NSString *)presentPrice
                                 originalPrice:(NSString *)originalPrice
                                 intervalSpace:(NSString *)intervalSpace
                               presentFontSize:(float)presenFontSize
                              originalFontSize:(float)originalFontSize;

/**
 *  调用QQ
 */
+ (BOOL)customServiceWithQQ:(NSString *)qqNum;

/**
 *  让键盘消失
 */
//+ (void)resignKeyBoardInView:(UIView *)view;

/**
 *  去App Store评价app
 */
+ (void)appraiseAppAtAppStote:(NSString *)appID;

/**
 *  去App Store下载app
 */
+ (void)downLoadAppAtAppStote:(NSString *)appID;

/**
 *  判断价格值是否有效。目前先判断促销价，再判断手机价
 */
+ (BOOL)isPriceValid:(NSString *)priceStr;

/**
 *  获取APP版本信息
 */
+ (NSString *)appVersionInfo;

+ (void)changeNavigationBar:(UIViewController*)VC;
//邮箱
+ (BOOL) validateEmail:(NSString *)email;

//手机号码验证
+ (BOOL)isMobileNumber:(NSString *)mobileNum;


//车牌号验证
+ (BOOL) validateCarNo:(NSString *)carNo;


//车型
+ (BOOL) validateCarType:(NSString *)CarType;

//用户名
+ (BOOL) validateUserName:(NSString *)name;

//密码
+ (BOOL) validatePassword:(NSString *)passWord;


//昵称
+ (BOOL) validateNickname:(NSString *)nickname;


//身份证号
+ (BOOL) validateIdentityCard: (NSString *)identityCard;

+(void)prompt:(NSString *)string with:(UIViewController *)vc;
//菊花体
+(void)ahahwith:(UIImageView *)customActivityIndicator;
+(void)miss:(UIImageView *)customActivityIndicator;

+ (UIColor *)colorWithHexString:(NSString *)color alpha:(CGFloat)alpha;
/**创建的是Label */
+(UILabel *) labfrome:(CGRect)from andText:(NSString *)text andColor:(UIColor *)color  andView:(UIView *)vc;
/**创建的是btn */
+(UIButton *) btnfrome:(CGRect)from andText:(NSString *)text andColor:(UIColor *)color andimg:(UIImage*)img andView:(UIView *)vc;
/**创建的是btn2 */
+(UIButton *) greenBtnfrome:(CGRect)from andText:(NSString *)text andColor:(UIColor *)color andimg:(UIImage*)img andView:(UIView *)vc;
/**创建的是view */
+(UIView *) viewfrome:(CGRect)from  andColor:(UIColor *)color  andView:(UIView *)vc;
/**创建的是img */
+(UIImageView *) imgfrome:(CGRect)from  andImg:(UIImage *)img  andView:(UIView *)vc;
/**创建的是textF */
+(UITextField *) textFieldfrome:(CGRect)from andText:(NSString *)text andColor:(UIColor *)color  andView:(UIView *)vc;
//lp --lab
//+(LPLabel *) lplLabfrome:(CGRect)from andText:(NSString *)text andColor:(UIColor *)color  andView:(UIView *)vc;
//+(SectionBtn *) sbtnfrome:(CGRect)from andText:(NSString *)text andColor:(UIColor *)color andimg:(UIImage*)img andView:(UIView *)vc;
//null转@""
+ (NSString *) NullString:(NSString *)string;
//空字符判断
+ (BOOL) isBlankString:(NSString *)string;
+(NSString*)md532BitLower:(NSString *)str;

+ (NSString *) isNullString:(NSString *)string;
//MD5加密
+(NSString*)createMd5Sign:(NSMutableDictionary*)dict;

+(void)keyboardExtension:(UITextField *)textField vc:(UIViewController *)sl btn:(UIButton *)btn;

//切圆
+(UIView *)viewCircle:(UIView *)myView withRadius:(int)radius;
//lab自适应
+(CGRect )fitLabFrom:(UILabel *)lab  withText:(NSString *)str withX:(CGFloat)xf withY:(CGFloat)yF withWidth:(CGFloat)widhtF withHeight:(CGFloat)heightF withL:(CGFloat)lx;


//今天-昨天-前天--日期格式修改
+(NSString *)compareDate:(NSDate *)date;
//删除字符串中的字符
+(NSString *) stringDeleteString:(NSString *)str;
@end
